import request from '@/utils/request';


// 获取组织列表
export function list(data = {}) {
  return request({
    url: '/user/organization/list',
    method: 'POST',
    data
  })
}

// 获取组织用户列表数据
export function organizationUserList(data = {}) {
  return request({
    url: '/user/organization/organizationUserList',
    method: 'post',
    data
  })
}

// 删除组织信息
export function deleteOrganization(data = {}) {
  return request({
    url: '/user/organization/delete',
    method: 'post',
    data
  })
}

// 移除组织用户
export function removeOrganizationUser(data = {}) {
  return request({
    url: '/user/organization/removeOrganizationUser',
    method: 'post',
    data
  })
}

// 根据组织ID查询组织信息
export function info(organizationId) {
  return request({
    url: `/user/organization/info/${organizationId}`,
    method: 'get'
  })
}

// 更新组织的状态
export function updateOrganizationStatus(status, organizationId) {
  return request({
    url: `/user/organization/updateOrganizationStatus/${status}/${organizationId}`,
    method: 'get'
  })
}

// 创建组织
export function createOrganization(data = {}) {
  return request({
    url: '/user/organization/create',
    method: 'post',
    data
  })
}

// 编辑组织
export function editOrganization(data = {}) {
  return request({
    url: '/user/organization/edit',
    method: 'post',
    data
  })
}

// 批量导入组织信息
export function importOrganization(data = {}) {
  return request({
    url: '/user/organization/importOrganization',
    method: 'post',
    data
  })
}

// 批量创建组织信息
export function batchCreate(data = {}) {
  return request({
    url: '/user/organization/batchCreate',
    method: 'post',
    data
  })
}

// 审批组织
export function approveOrganization(data = {}) {
  return request({
    url: '/user/organization/approveOrganization',
    method: 'post',
    data
  })
}

// 导出组织
export function exportOrganization(data = {}) {
  return request({
    url: '/user/organization/exportOrganization',
    method: 'post',
    data,
    responseType: 'blob'
  })
}

// 获取用户申请加入组织的列表
export function applyJoinOrganizationList(data = {}) {
  return request({
    url: '/user/organization/applyJoinOrganizationList',
    method: 'post',
    data
  })
}

// 审批用户申请加入组织
export function approveUserJoinOrganization(data) {
  return request({
    url: `/user/organization/approveUserJoinOrganization`,
    method: "POST",
    data
  });
}

// 删除用户申请加入组织记录
export function deleteApplyJoinOrganization(data = {}) {
  return request({
    url: '/user/organization/deleteApplyJoinOrganization',
    method: 'post',
    data
  })
}

// 获取申请创建组织信息的列表
export function getApplyOrganizationList(data = {}) {
  return request({
    url: '/user/organization/getApplyOrganizationList',
    method: 'post',
    data
  })
}

// 删除用户申请创建组织记录
export function deleteApplyCreateOrganization(data = {}) {
  return request({
    url: '/user/organization/deleteApplyCreateOrganization',
    method: 'post',
    data
  })
}

// 获取组织列表
export function organizationListByKeyword(keyword) {
  return request({
    url: '/user/api/organization/organizationList',
    method: 'get',
    params: {
      keyword
    }
  })
}
